package com.devunion.bogdan.view.actions;

import com.devunion.bogdan.model.project.ProjectManager;
import com.devunion.bogdan.model.project.ProjectSavingException;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * @author Viktar Liaskovich
 */
public class FileExitAction extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
        try {
            if (ProjectManager.getInstance().getCurrentProject() != null) {
                ProjectManager.getInstance().closeProject();
            }
        } catch (ProjectSavingException e1) {
            e1.printStackTrace();
        }

        System.exit(0);
    }
}
